package day06;
import java.util.Arrays;
public class MaxArray {
    public static void main(String[] args) {
        int []a=new int[7];
        for (int i=0;i< a.length;i++){
            a[i]=(int) (Math.random()*100+1);
            System.out.println(a[i]);
        }

        int max=a[0];
        for (int i=1;i<a.length;i++){
            if (a[i]>max){
                max=a[i];
            }
        }
        System.out.println("最大值为" +max);
        a=Arrays.copyOf(a,a.length+1);
        a[a.length-1]=max;
        for (int i=0;i<a.length;i++){
            System.out.println(a[i]);
        }
    }

}
